package com.dede.monochromatism

import android.app.Application
import com.dede.applib.CrashHandler
import com.dede.applib.util.JavaShellUtil
import com.dede.monochromatism.service.DbLoaderService
import com.squareup.leakcanary.LeakCanary
import org.jetbrains.anko.defaultSharedPreferences
import org.jetbrains.anko.startService

/**
 * @author hsh
 * @date 2017/9/19 16:58.
 * @doc
 */
class MyApp : Application() {

    override fun onCreate() {
        super.onCreate()
        if (LeakCanary.isInAnalyzerProcess(this)) {
            return
        }
        LeakCanary.install(this)

        JavaShellUtil.root(true)
        CrashHandler.instance().init(this)

        val status = defaultSharedPreferences.getBoolean(S_PRE_STATUS, false)
        if (status) {
            startService<DbLoaderService>()
        }
    }
}